//
//  GongGaoView.m
//  wangzhe
//
//  Created by 李 佳伟 on 2017/10/13.
//  Copyright © 2017年 李 佳伟. All rights reserved.
//

#import "GongGaoView.h"

#import "JTCSM.h"

@interface GongGaoView ()

@property (nonatomic,strong) UIImageView *titleImageView;
@property (nonatomic,strong) UILabel *titleLabel;

@end

@implementation GongGaoView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (id)initWithFrame:(CGRect)frame title:(NSString *)title contetnt:(NSString *)content{
    self = [super initWithFrame:frame];
    if (self) {
        
        CGFloat top = 10;
//        [df lineViewWithHeightofTop:top superView:self spacing:-100 color:RGBACOLOR(241, 241, 241, 1) lineHeight:top];
        
        CGFloat Height = frame.size.height-top*2;
        CGFloat Width  = frame.size.width;
        CGFloat logoImagesize = 25;
        
        self.titleImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, (Height-logoImagesize)/2+top-2, logoImagesize, logoImagesize)];
        [self addSubview:self.titleImageView];
        self.titleImageView.image = [UIImage imageNamed:@"myshouyi.png"];
        
        NSString *titleStr = @"我的收益（元）";
        CGRect rect = [df labelHeightWithContent:titleStr height:Height font:14];
        
        self.titleLabel = [UILabel initWithFrame:CGRectMake(KVIEW_Y(self.titleImageView)+10, top, rect.size.width, Height) text:titleStr font:14 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(51,51,51, 1) backgroundColor:nil];
        [self addSubview:self.titleLabel];
        
        [df fuwenbenLabel:self.titleLabel FontNumber:[UIFont systemFontOfSize:14] AndRange:NSMakeRange(4, 3) AndColor:RGBACOLOR(153, 153, 153, 1)];
        
        CGFloat imagesize = 15;
        self.contentLabel = [UILabel initWithFrame:CGRectMake(KVIEW_X(self.titleImageView)+10, top,Width-KVIEW_X(self.titleImageView)-40-imagesize, Height) text:content font:16 textAlignment:NSTextAlignmentRight texcolor:RGBACOLOR(255,54,54, 1) backgroundColor:nil];
        [self addSubview: self.contentLabel];
        
        UIImageView *imageView  = [[UIImageView alloc]initWithFrame:CGRectMake(Width-imagesize,top+ (Height-imagesize)/2, imagesize, imagesize)];
        imageView.image = [UIImage imageNamed:@"myFanhui.png"];
        [self addSubview:imageView];
        
        [df lineViewWithHeightofTop:frame.size.height superView:self spacing:-100 color:RGBACOLOR(241, 241, 241, 1) lineHeight:1];
    }
    
    return self;
}

@end
